<?php

/**
 * GameAccessory form base class.
 *
 * @method GameAccessory getObject() Returns the current form's model object
 *
 * @package    aiontoolskit
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGameAccessoryForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'item_type'        => new sfWidgetFormChoice(array('choices' => array('abyss' => 'abyss', 'draconic' => 'draconic', 'normal' => 'normal'))),
      'icon_name'        => new sfWidgetFormInputText(),
      'equipment_slots'  => new sfWidgetFormChoice(array('choices' => array('neck' => 'neck', 'right_or_left_ear' => 'right_or_left_ear', 'right_or_left_finger' => 'right_or_left_finger', 'waist' => 'waist'))),
      'quality_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameItemQuality'), 'add_empty' => false)),
      'level'            => new sfWidgetFormInputText(),
      'gender_permitted' => new sfWidgetFormChoice(array('choices' => array('all' => 'all', 'female' => 'female', 'male' => 'male'))),
      'bonus_apply'      => new sfWidgetFormChoice(array('choices' => array('equip' => 'equip', 'inventory' => 'inventory'))),
      'faction_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameFaction'), 'add_empty' => false)),
      'bonus_attr1'      => new sfWidgetFormInputText(),
      'bonus_attr2'      => new sfWidgetFormInputText(),
      'bonus_attr3'      => new sfWidgetFormInputText(),
      'bonus_attr4'      => new sfWidgetFormInputText(),
      'bonus_attr5'      => new sfWidgetFormInputText(),
      'bonus_attr6'      => new sfWidgetFormInputText(),
      'bonus_attr7'      => new sfWidgetFormInputText(),
      'bonus_attr8'      => new sfWidgetFormInputText(),
      'bonus_attr9'      => new sfWidgetFormInputText(),
      'bonus_attr10'     => new sfWidgetFormInputText(),
      'bonus_attr11'     => new sfWidgetFormInputText(),
      'bonus_attr12'     => new sfWidgetFormInputText(),
      'magical_resist'   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'item_type'        => new sfValidatorChoice(array('choices' => array(0 => 'abyss', 1 => 'draconic', 2 => 'normal'), 'required' => false)),
      'icon_name'        => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'equipment_slots'  => new sfValidatorChoice(array('choices' => array(0 => 'neck', 1 => 'right_or_left_ear', 2 => 'right_or_left_finger', 3 => 'waist'), 'required' => false)),
      'quality_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameItemQuality'))),
      'level'            => new sfValidatorInteger(array('required' => false)),
      'gender_permitted' => new sfValidatorChoice(array('choices' => array(0 => 'all', 1 => 'female', 2 => 'male'), 'required' => false)),
      'bonus_apply'      => new sfValidatorChoice(array('choices' => array(0 => 'equip', 1 => 'inventory'), 'required' => false)),
      'faction_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameFaction'))),
      'bonus_attr1'      => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'bonus_attr2'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr3'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr4'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr5'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr6'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr7'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr8'      => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr9'      => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr10'     => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr11'     => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr12'     => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'magical_resist'   => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('game_accessory[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GameAccessory';
  }

}
